#!/bin/bash

workdir=$(pwd)
cd $workdir;
./composer.phar install-dependencies
./composer.phar post-deploy $1
# php artisan queue:restart
php artisan horizon:terminate

if [ "$2" != "production" ]
then
    # php artisan queue:work --queue=high,laravel-test,low --sleep=5 --timeout=30 --tries=3 --delay=3 >/dev/null 2>&1 &
    echo '启动 horizon'
    php artisan horizon >/dev/null 2>&1 &
    # echo '关闭 short-schedule'
    # php artisan short-schedule:kill
    # echo '启动 short-schedule'
    # php artisan short-schedule:run 2>&1 &
    # echo -e "${!}\n" >> deploy/short-schedule.lock
    #laravel-echo-server start --config=laravel-echo/laravel-echo-server.json
# elif [ "$2" == "production" ]
    # 重启线上秒级定时器
    # supervisorctl restart zw-wealth-short-schedule:*
fi
